<?php

/**
 * test
 */

class TestAction extends YbaseAction{

	function __construct(){
		parent::__construct();
	   $check = 	$this->verifySign();

	}

	public function index(){
		//$rep = array();
		$api_url  = "http://www.dev.com/index.php?g=Api&c=Ybase";

		$rep['name'] = '隔壁老王';
		$rep['email'] = '2343@qq.com';
		$rep['ssf'] = '234sdf.com';

		$x['name'] = '隔壁老王';
		$x['email'] = '2343@qq.com';
		$x['ss'] = '2cxvcvxcvcxvcxvcxvcxvm';
		$x['ddd'] = '432432432om';
//		$client = new  Yar_Client();
//		$result = $client->index($rep);
//		dump($result);
//		if(is_array($rep)){
//			echo "Yes";
//		}
		//Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");


		Yar_Concurrent_Client::call($api_url,'index',array($rep));
		Yar_Concurrent_Client::call($api_url,'ytest',array($x));
		Yar_Concurrent_Client::loop();

//		Yar_Concurrent_Client::call($api_url,'index',array('name'=>'2test.com','time'=>time(),'t'=> __FUNCTION__ ),'callback');
//		Yar_Concurrent_Client::call($api_url,'index',array('name'=>'3test.com','time'=>time(),'t'=> __FUNCTION__ ),'callback');
		//Yar_Concurrent_Client::loop();

		//return $this->yresponse($rep);

	}

	public function test($data){
		return json_encode($data);
		$rep['name'] = 'test';
		$rep['email'] = '55222@qq.com';
		$rep['niubi'] = '爱丽丝福建省大了发了';
		$rep['time'] = time();
		$rep['code'] = 0;
		$client = new  Yar_Client("http://www.dev.com/index.php?g=Api&c=Ybase");
		//$result     = $client->response($rep,'jsonp');
		$result_xml = $client->response($rep,'xml');
		//$result_json = $client->response($rep,'json');
		//dump($result);
		//dump($result_xml);
		//dump($result_json);
	}

	public function callback($retval,$callinfo){
		var_dump($retval);
	}

}
